﻿using KYDataMigrationDemo02.Application.Dtos;
using KYDataMigrationDemo02.Application.IServices;
using KYDataMigrationDemo02.Core.DbContextLocator;
using KYDataMigrationDemo02.Core.Entities.PostgreSql;

namespace KYDataMigrationDemo02.Application.Services
{
    public class UserService : IUserService
    {
        private readonly IRepository<UserInfo, PostgreSqlDbContextLocator> reposPostgreSql;

        public UserService(IRepository<UserInfo, PostgreSqlDbContextLocator> reposPostgreSql)
        {
            this.reposPostgreSql = reposPostgreSql;
        }

        public List<UserDto> GetAll()
        {
            return reposPostgreSql.AsQueryable()
                                  .ToList()
                                  .Adapt<List<UserDto>>();
        }
    }
}
